package com.ndp.fb.enums.adcampaigngroups;

import lombok.Getter;

/**
 * Created by infi.he on 2015/4/29.
 */
@Getter
public enum AdCampaignGroupStatus {
    /**
     *ACTIVE
     */
    ACTIVE ("ACTIVE", 1),

    /**
     *PAUSED
     */
    PAUSED("PAUSED", 2),

    /**
     *ARCHIVED
     */
    ARCHIVED("ARCHIVED", 3);

    /**
     *status
     */
    private String status;

    /**
     *code
     */
    private int code;

    /**
     * campaigngroupstatus
     * @param status status
     * @param code code
     */
    private AdCampaignGroupStatus(String status,  int code){
        this.status = status;
        this.code = code;
    }

    /**
     * 根据code获取Status
     * @param code code
     * @return Status
     */
    public static AdCampaignGroupStatus getStatus(int code) {
        for (AdCampaignGroupStatus c : AdCampaignGroupStatus.values()) {
            if (c.code == code) {
                return c;
            }
        }
        return null;
    }

    /**
     * 根据status获取Status
     * @param status status
     * @return Status
     */
    public static AdCampaignGroupStatus getStatus(String status) {
        for (AdCampaignGroupStatus c : AdCampaignGroupStatus.values()) {
            if (c.status.equals(status)) {
                return c;
            }
        }
        return null;
    }

    public String getStatus(){
        return status;
    }

}
